<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/views/global/taglibs.jsp" %>
<style type="text/css">
	.main-md DIV.form-group{border-bottom: 1px dashed #ddd;}
	.grid .g-u {
	   display:inline-block
	}
	.maincontent{background: #e4e7ea;} 
	.text-muted {
	    text-transform: uppercase;
    }
    .results-list .media {
    border-bottom: 1px solid #eee;
	}
	.results-list .media-object {
	    width: 125px;
	    margin-right: 10px;
	}
	.results-list .filename {
	    margin: 0;
	    font-size: 16px;
	}
	.results-list .media-body {
	    line-height: 18px;
	}
</style>
<div class="main">      
	<div class="row">
		<div class="col-md-12">
			<form id="itemForm" class="form-horizontal" role="form" name="itemForm"  method="post">
			<div class="panel panel-default">
				<div class="panel-heading">
					<div class="panel-title">卖家身份审核搜索</div>
				</div>
				<div class="panel-body">
					<div class="form-group">
					    <label class="col-sm-1 control-label" for="disType">审核状态: </label>
						<div class="col-sm-3">
							<select id="auditStatus" name="status" class="form-control" data-placeholder="审核状态" value="${queryParamVo.status }">
			                         <option value="">请选择</option>
			                         <option value="audit" <c:if test="${queryParamVo.status eq 'audit' }">selected</c:if>  >待审核</option>
			                         <option value="audit_success" <c:if test="${queryParamVo.status eq 'audit_success' }">selected</c:if>  >审核通过</option>
			                         <option value="audit_fail" <c:if test="${queryParamVo.status eq 'audit_fail' }">selected</c:if>  >审核未通过</option>
					         </select>
						</div>
						<label class="col-sm-2 control-label" for="sellerName">Designer名称: </label>
						
						<div class="col-sm-4">
							<input class="form-control" name="sellerName" id="sellerName" value="${queryParamVo.sellerName }"/>
						</div>
						<div class="col-sm-2">
							<button type="submit" class="btn btn-primary">搜 索</button>
						</div>
					</div>
				</div>
			</div>
			<pagination:pagenav pageInfo="${pageInfo }" url="${actionPath }" formName="itemForm" showTotalSize="true"></pagination:pagenav>
			</form>
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="results-list">
                     <div class="row">
                        <c:forEach var="entry" items="${entryList }">
                         <div class="media">
                           <div class="col-md-1">
                              <c:choose>
                                 <c:when test="${entry.status eq 'audit' }">
                                     <a href="#">待审核</a>
                                 </c:when>
                                 <c:when test="${entry.status eq 'audit_success' }">
                                     <a href="#">审核通过</a>
                                 </c:when>
                                 <c:when test="${entry.status eq 'audit_fail' }">
                                     <a href="#">审核不通过</a>
                                 </c:when>
                                 <c:otherwise> 
                                 </c:otherwise>
                              </c:choose>
                           </div>
                           <div class="col-md-10">
                           	 <div class="row">
                           	 	<div class="col-xs-5">
                           	 		<a href="seller/store/designerApplyDetail?id=${entry.id }" target="blank"><img alt="" src="${fileServerBasePath }download/${entry.sellerFileId }" width="300" height="250"></a>
                           	 	</div>
                           	 	<div class="col-xs-7">
                           	 		<div class="text-muted">Designer名称: ${entry.sellerName }</div>
                           	 		<div class="text-muted">店铺名称: ${entry.storeName }</div>
		                            <div class="text-muted">店铺地址: ${entry.strLocationNames }</div>
		                            <div class="text-muted">描述: ${entry.favorite }</div>
                           	 	</div>
                           	 </div>
                           </div>
                           <div class="col-md-1">
                            <c:if test="${entry.status eq 'audit' or  entry.status eq 'audit_fail'}">
                               <a href="javascript:void(0)" onclick="showDialog('${entry.id}')">审核</a><br/>
                            </c:if>
                           
                           </div>
                         </div>
                        </c:forEach>
                      </div>
                    </div><!-- results-list -->
                </div><!-- panel-body -->
            </div><!-- panel -->
     	</div><!-- col-sm-8 -->
     	
	</div>
</div>
<script type="text/javascript" src="static/javascript/global/artDialog/artDialog.js?skin=default"></script>
<script type="text/javascript">
$(document).ready(function(){
	<c:if test="${empty message }">$(".alert").hide();</c:if>
	
});

function showDialog(id){
	art.dialog({
		title:"审批",
        content: "<input type='hidden' id='designerApplyId' name='designerApplyId' value='"+id+"'/><textarea id='comments' name='comments' rows='5' cols='60' > </textarea>",
        drag: false,
        lock: false,//是否遮罩
        okVal:'审核通过',
        cancelVal:'审核不通过',
        ok: function() {
        	
        	$("#itemForm").goAjax({
    			url:"seller/store/auditApply",
    			type: "POST",
    			semantic:false,
    			dataType: "json",
    			data:{id:$("#designerApplyId").val(),auditStatus:"audit_success",comments:$("#comments").val()},
    			success: function(jsonData) {
    				if(true == jsonData.success){
    					window.location.href="admin/designerApplyAuditList"
    				} else {
    					art.dialog({title:"ERROR", icon: "error", content: "UPLOAD FAILURE! "});
    				}
    			}
    		});
            return true;
        },
        cancel: function(){
        	$("#itemForm").goAjax({
    			url:"seller/store/auditApply",
    			type: "POST",
    			semantic:false,
    			dataType: "json",
    			data:{id:$("#designerApplyId").val(),auditStatus:"audit_fail",comments:$("#comments").val()},
    			success: function(jsonData) {
    				if(true == jsonData.success){
    					window.location.href="admin/designerApplyAuditList"
    				} else {
    					art.dialog({title:"ERROR", icon: "error", content: "UPLOAD FAILURE! "});
    				}
    			}
    		});
            return true;
        }
    });
}
//图片按比例缩放
var flag=false;
function drawImage(ImgD,iwidth,iheight){
	//参数(图片,允许的宽度,允许的高度)
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
	flag=true;
	if(image.width/image.height>= iwidth/iheight){
	if(image.width>iwidth){ 
	ImgD.width=iwidth;
	ImgD.height=(image.height*iwidth)/image.width;
	}else{
	ImgD.width=image.width; 
	ImgD.height=image.height;
	}
	ImgD.alt=image.width+"×"+image.height;
	}
	else{
	if(image.height>iheight){ 
	ImgD.height=iheight;
	ImgD.width=(image.width*iheight)/image.height; 
	}else{
	ImgD.width=image.width; 
	ImgD.height=image.height;
	}
	ImgD.alt=image.width+"×"+image.height;
	}
	}
} 


</script>
